#pragma once

//Vektor 
#include "main.h"

class Vec2
{
public:
	union{
		struct{
			double x;
			double y;
		};
		char str[16];
	};
	Vec2(void);
	Vec2(double _x, double _y);
	~Vec2(void);

	Vec2 &operator=(const Vec2 &rhs);
	int operator==(const Vec2 &rhs) const;
	int operator<(const Vec2 &rhs) const;
	Vec2 diff(const Vec2 v);
	Vec2 mul(const Vec2 v);
	Vec2 mul(const double a);
	Vec2 add(const Vec2 v);

	double length_();
	Vec2 normalize();

};

namespace std
{
	template <>
	struct less<Vec2>{

		bool operator() (const Vec2& lhs, const Vec2& rhs)
		{	
			if(lhs.x < rhs.x){
				return true;
			}else{
				if(lhs.x > rhs.x){
					return false;
				}
			}
			if(lhs.y < rhs.y){
				return true;
			}else{
				if(lhs.y > rhs.y){
					return false;
				}
			}	
			return false;
		};
	};
} ;